package org.zhadoop.stream.cql.semanticanalyzer.parser.context;

import java.util.List;

import org.zhadoop.stream.cql.DriverContext;
import org.zhadoop.stream.cql.exception.CQLException;
import org.zhadoop.stream.cql.exception.SemanticAnalyzerException;
import org.zhadoop.stream.cql.hooks.SemanticAnalyzeHook;
import org.zhadoop.stream.cql.semanticanalyzer.SemanticAnalyzer;
import org.zhadoop.stream.cql.semanticanalyzer.parsecontextwalker.ParseContextWalker;
import org.zhadoop.stream.cql.tasks.Task;

import com.google.common.base.Joiner;
import com.google.common.collect.Lists;

/**
 * select 表达式别名解析类型
 * @author zwd
 *
 */
public class SelectAliasContext extends ParseContext{
	private List<String> alias;
	
	public SelectAliasContext() {
		alias = Lists.newArrayList();
	}

	@Override
	public String toString() {
		if (alias.size() == 1)
        {
            return "AS " + alias.get(0);
        }
        
        return "AS (" + Joiner.on(", ").join(alias) + ")";
	}
	

	public List<String> getAlias() {
		return alias;
	}

	public void setAlias(List<String> alias) {
		this.alias = alias;
	}

	@Override
	public Task createTask(DriverContext driverContext, List<SemanticAnalyzeHook> analyzeHooks) throws CQLException {
		return null;
	}

	@Override
	public SemanticAnalyzer createAnalyzer() throws SemanticAnalyzerException {
		return null;
	}

	@Override
	protected void walkChild(ParseContextWalker walker) {
		
	}
	
}
